//存放公共api方法
import { REQUEST_TAG } from '@/config'
import { postRequest, getRequest } from '../utils/request'

// 公共图片上传 (不需要token验证)
export const imageUpload = (data: any): Promise<any> => postRequest(`/api/${REQUEST_TAG}/public/upload/image`, data)

// 公共excel文件上传 (不需要token验证)
export const excelUpload = (data: any): Promise<any> => postRequest(`/upload/excel`, data)

// 公共excel文件导入 (不需要token验证)
export const excelImport = (data: any): Promise<any> => postRequest(`/upload/import`, data)

// 用户登录
export const userLogin = (data: any): Promise<any> => postRequest(`/api/${REQUEST_TAG}/public/login`, data)

// 无感刷新token
export const refreshToken = (data: any): Promise<any> => postRequest(`/api/${REQUEST_TAG}/public/refreshToken`, data)

// 用户信息
export const getUserInfo = (data: any): Promise<any> => getRequest(`/api/${REQUEST_TAG}/user/getUserInfo`, data)

// menu
export const getMenuInfo = (data: any): Promise<any> => getRequest(`/api/${REQUEST_TAG}/user/getAppInfo`, data)

// 老人管理添加时选择框内容
export const getSeleData = (data?: any): Promise<any> => postRequest(`/api/${REQUEST_TAG}/user/getSelect`, data)

// 老人管理添加时护理员选择框内容
export const getNurseSeleData = (data?: any): Promise<any> =>
  postRequest(`/api/${REQUEST_TAG}/user/getUserSelect/grade`, data)

// 获取所有省市区列表
export const getAdressData = (data?: any): Promise<any> => postRequest(`/api/${REQUEST_TAG}/user/getRegions`, data)

// 补全内容
export const getRegions = (data?: any): Promise<any> => postRequest(`/api/${REQUEST_TAG}/user/getRegionsFromKeys`, data)

export const listApp = (data?: any): Promise<any> => postRequest('/api/application/user/get_app_lists', data)

// 获取机构列表
export const getOrganSelect = (data?: any): Promise<any> => getRequest('/api/user/user/get_org_select', data)

export const appidSetRoule = (data?: any): Promise<any> => postRequest(`/api/${REQUEST_TAG}/user/SetRole`, data)

export const appidDelRoule = (data?: any): Promise<any> => postRequest(`/api/${REQUEST_TAG}/user/DelRole`, data)

//修改密码
export const changePassWord = (data?: any): Promise<any> => postRequest(`/api/${REQUEST_TAG}/user/editPwd`, data)
